package com.xyebank.ledger.service.zy.dataprovider.pay;


import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.xyebank.ledger.service.common.DataProvider;
import com.xyebank.ledger.service.zy.dataprovider.repay.SZyCashRepaymentMapper;
import com.xyebank.ledger.vo.deal.ZYCashPaymentInfVo;

@Component
public class ZyPayDataProvider implements DataProvider<ZYCashPaymentInfVo> {

    @Autowired
    private SZyCashPaymentMapper mZyCashPaymentMapper;

    @Override
    public List<ZYCashPaymentInfVo> get(Integer fromIdx, Integer tarNum) {
        List<SZyCashPayment> result = mZyCashPaymentMapper.selectByPaging(fromIdx, tarNum);
        List<ZYCashPaymentInfVo> list = new ArrayList<ZYCashPaymentInfVo>();
        for (int i = 0; i < result.size(); i++) {
            ZYCashPaymentInfVo vo = new ZYCashPaymentInfVo();
            BeanUtils.copyProperties(result.get(i), vo);
            list.add(vo);
        }
        return list;
    }


    @Override
    public List<ZYCashPaymentInfVo> get(Date dateStart, Date dateEnd, Integer fromIdx, Integer tarNum) {
        //TODO 从数据库读取 index, num
        return null;
    }

    @Override
    public Integer count(Date timeStart, Date timeEnd) {
        return null;
    }
}
